package GUitest;

import javax.swing.*;
import java.awt.*;

public class ImageIconDemo extends JFrame {
    public static void main(String[] args) {
        new ImageIconDemo();
    }
    public ImageIconDemo(){
        JFrame frame = new JFrame("test");


        ImageIcon icon = new ImageIcon("GUI\\images\\delete.jpg");
        JButton b = new JButton("删除", icon);
        frame.add(b);
        frame.setIconImage(icon.getImage());
        JLabel lbl = new JLabel(icon);

        frame.add(lbl);
        frame.setLayout(new FlowLayout());
        frame.setSize(500, 500);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
